import axios from 'axios';//注意发送请求前应该设置代理,解决跨域
// 进度条效果
import nprogress from 'nprogress';
import 'nprogress/nprogress.css'
const requests=axios.create({
    baseURL:'/api',
    timeout:5000
})
// 请求拦截
requests.interceptors.request.use(config => {
    nprogress.start()
    return config
})
// 响应拦截
requests.interceptors.response.use(
    res=>{
        nprogress.done()
        console.log('请求成功');
        return res.data
    },
    err=>{
        console.log('响应失败',err);
    }
)
export default requests;